import arcpy, csv
from arcpy import env
env.overwriteOutput='TRUE'
def main():


    fc="E:\\cp\\prac.mdb\\distlines"
    fields=["SHAPE@","OBJECTID","TransOrder"]
    scursor=arcpy.da.SearchCursor(fc,fields)

    print "NEW RUN"

    glist=[]
    for i in scursor:
        
        geom=i[0]
        length=geom.length
        
        dist = length+findIt(i[2])
    
        pos=geom.positionAlongLine(dist)
        glist.append(pos)
    
    arcpy.CopyFeatures_management(glist, "E:\\cp\\prac.mdb\\newpoints")



def findIt(tid):
    print "Finding", tid
    with open("E:\\cp\\csv\\Trans11UTM_rates.csv",'rb') as csvf:
        cread = csv.reader(csvf)
    
        for i in cread:
            
            if str(i[1])== str(tid):
                print i[1], i[8]
                num=i[8]
                num=num.strip(".#IND")
                
                return float(num)
def moveWest:
    
def moveEast:

             
    
main()  
